module ApplicationHelper
  def title(page_title)
    content_for(:title) { page_title }
  end

  def queue_js(src)
    content_for(:queue_js) { javascript_include_tag src }
  end

  def queue_css(src)
    content_for(:queue_css) { stylesheet_link_tag src }
  end

  def is_admin
    user = session[:student]
    if user.nil?
      @is_admin = false
    else
      @is_admin = StudentGroupLink.check_admin(user[:id])
    end
  end

  def format_status(status)
    status_array = {
        '0' => t('library.document.not_available'),
        '1' => t('library.document.available'),
        '-1' => t('library.document.deleted'),
        ''  =>  t('library.document.unknown')
    }
    @status_out = status_array[status]
  end

end
